In the previous video,
you understood anchors. By the end of this video, you will be able to understand the tools to
fine-tune selectors. Let's get started.
In most cases, the automatically
generated selectors are not reliable enough. This issue is solved
by Fine-Tuning. Fine-Tuning is the process of refining selectors
to have the workflow correctly executed
in situations in which the generated
selector is unreliable, too specific, or too sensitive with regards
to system changes. It mainly consists of changes
such as adding wildcards, using the repair function, or using variables
and selectors. These changes are
small and simple, yet they have a big impact on the stability of the
automation process. The different tools to fine-tune selectors
are Anchor Base, Relative Selector, Visual Tree Hierarchy,
and Find Children. Let's understand each
in detail. Anchor Base. It is useful in cases in which the attribute
values are not reliable but a stable UI
element exists on the screen. In such case, the stable UI element is linked
to the target UI element using the anchor-based
activity Relative Selector. A selector can be
improved by using the indicate anchor
option in UI Explorer. It incorporates the
information about the anchor selector in the selector of the
target UI element. However, the new selector
will probably need additional editing as
the part that made the first selector will still
be in the new selector. That part, like a dynamic ID, needs to be removed
and the selector will stabilize using
the anchor's selector. Visual Tree Hierarchy. It is useful when the target UI element
selector is not reliable, but the selector of
the UI element right above in the hierarchy
is reliable. Here, the selector needs
further editing and validation as the dynamic
part needs to be removed. This can be done using
the UI Explorer, which you learned in
the previous part of the course. Fine Children. It identifies the children
of a certain UI element. The output of the activity is
the collection of children. To make it work,
the user needs to come up with a
mechanism to identify only the target UI
element using one of its attributes that makes it
unique between the children, but wouldn't be enough to
identify it universally. Now, let us understand the recommended approach
to fine-tune selectors, which consists of six steps. In the first step, use the selector editor to
inspect the applications. In the second step, examine the elements from
the selector editor path. In the third step, identify the element causing the issue, and in the fourth
step, change elements, attributes through
indicate element and use UI Explorer to find various
selectors using Visual Tree. In the fifth step, highlight the application after
modifying attribute value. In the sixth step, test the functionality of the
recently debugged element. Next in this lesson is
a reading material that explains the tools and approach
to fine-tune selectors. Thank you for watching.